package com.miage.ldapsec.obj;

import java.util.ArrayList;


public class Group {

    protected String dn;
    protected String commonName;
    protected ArrayList<User> arrUser;

    public Group(String dn, String commonName) {
        this.dn = dn;
        this.commonName = commonName;
        this.arrUser = new ArrayList<User>();
    }

    public Group() {
        this(null, null);
    }

    public String getCommonName() {
        return commonName;
    }

    public ArrayList<User> getArrUser() {
        return arrUser;
    }

    public void setArrUser(ArrayList<User> arrUser) {
        this.arrUser = arrUser;
    }

    public String getDn() {
        return dn;
    }

    public void setDn(String dn) {
        this.dn = dn;
    }

    @Override
    public String toString() {
        return dn;
    }

    public boolean hasMember() {
        return !arrUser.isEmpty();
    }

    public int nbMember() {
        return arrUser.size();
    }
    
    public boolean isEmpty() {
        return commonName==null;
    }
    
    public boolean isComplete() {
        return !commonName.isEmpty();
    }
}